<?php
/**
 *
 * 版权所有：恰维网络<qwadmin.qiawei.com>
 * 作    者：寒川<hanchuan@qiawei.com>
 * 日    期：2016-01-21
 * 版    本：1.0.0
 * 功能说明：前台控制器演示。
 *
 **/
namespace Home\Controller;

use Vendor\Page;

class IndexController extends ComController
{
    //幼儿园项目首页
    public function index()
    {   
        $uid = 1;//平台
        $list = M('flash')->where('sc_id ='.$uid)->order('o asc,add_time desc')->limit('0,6')->select();
        $this->assign('list', $list);
        $this->display('education');
    }
    //幼儿园列表
    public function kindergarten_list(){
        $p= intval($_GET['p'])?$_GET['p']:1;
        $pagesize = 8;#每页数量
        $offset = $pagesize * ($p - 1);//计算记录偏移量
        $member = M('member')->where(array('level'=>1))->limit($offset . ',' . $pagesize)->order("uid desc")->select();
        $this->assign('member',$member);
        $this->display('kindergarten-list');
    }
    //上拉加载数据
    public function getData(){
        $p= intval($_GET['p'])?$_GET['p']:1;
        $pagesize = 15;#每页数量
        $offset = $pagesize * ($p - 1);//计算记录偏移量
        $member = M('member')->where(array('level'=>1))->limit($offset . ',' . $pagesize)->order("uid desc")->select();
        if(empty($member)){
            echo 1;exit;
        }
        $this->assign('member',$member);
        $this->display();
    }
    //幼儿园主页
    public function index_education(){
        $uid = I('get.uid') ? I('get.uid') : 0;
        $member = M('member')->where(array('uid'=>$uid))->find();
        $list = M('flash')->where('sc_id ='.$uid)->order('o asc')->limit('0,6')->select();
        //通知公告轮播
        $notice = M('notice');
        $not=$notice->where('sc_id ='.$uid)->field('id,title')->order('add_time desc')->limit(5)->select();
        $this->assign('notice',$not);
        $this->assign('list', $list);
        $this->assign('member',$member);
        $this->display('index');
    }




}